//
//  ViewController.m
//  GCD作业
//
//  Created by mafeng on 16/8/17.
//  Copyright © 2016年 mafeng. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    dispatch_queue_t myQuene = dispatch_queue_create("com.iphonedevblog.post", NULL);
   
    dispatch_async(myQuene, ^{
        
        [self handData];
        
    });
    for (int i = 0; i < 1000; i ++) {
        
    }
    NSLog(@"🐂");
    
    NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(handData) object:nil];
    [operation start];
    [operation isFinished];
    [operation cancel];
    [operation waitUntilFinished];

    
    
    NSOperationQueue *queue = [NSOperationQueue mainQueue];
    
    
    
}

- (void)handData {
    
    NSLog(@"❤️");
    for (int i = 0; i < 1000; i++) {
        NSLog(@"%d", i);
    }
    dispatch_async(dispatch_get_main_queue(), ^{
        NSLog(@"哈哈, 在主线程了");
        
    });
   
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
